import request from '@/config/axios'

// 用户积分流水 VO
export interface UserPointRecordsVO {
  id: number // 租户编号
  userId: number // 用户id
  opType: boolean // 操作类型：0 增加；1 扣减；
  bizType: boolean // 业务类型
  bizId: number // 业务id
  points: number // 变动积分
  remark: string // 备注
  totalPoints: number // 变动后的积分
}

// 用户积分流水 API
export const UserPointRecordsApi = {
  // 查询用户积分流水分页
  getUserPointRecordsPage: async (data) => {
    return await request.post({ url: `/member/user-point-records/page`, data:data })
  },

  // 查询用户积分流水详情
  getUserPointRecords: async (id: number) => {
    return await request.get({ url: `/member/user-point-records/get?id=` + id })
  },

  // 新增用户积分流水
  createUserPointRecords: async (data: UserPointRecordsVO) => {
    return await request.post({ url: `/member/user-point-records/create`, data })
  },

  // 修改用户积分流水
  updateUserPointRecords: async (data: UserPointRecordsVO) => {
    return await request.put({ url: `/member/user-point-records/update`, data })
  },

  // 删除用户积分流水
  deleteUserPointRecords: async (id: number) => {
    return await request.delete({ url: `/member/user-point-records/delete?id=` + id })
  },

  // 导出用户积分流水 Excel
  exportUserPointRecords: async (params) => {
    return await request.download({ url: `/member/user-point-records/export-excel`, params })
  }
}
